cpupower: Fix checks for CPU existence
authorBen Hutchings <ben@decadent.org.uk>
Thu, 3 Nov 2016 21:25:26 +0000 (15:25 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 27 Feb 2017 15:58:07 +0000 (15:58 +0000)
commitda552e634dbc3e14295649aff9ef390de4db09ec
tree6387c88da220c3da783d153d4eff161bc7238979
parent0bcdab7c8b4768eb576f02b41e61ab2376c91ee0
cpupower: Fix checks for CPU existence

Calls to cpufreq_cpu_exists(cpu) were converted to
cpupower_is_cpu_online(cpu) when libcpupower was introduced and the
former function was deleted.  However, cpupower_is_cpu_online()
returns 1 on success whereas cpufreq_cpu_exists() returned 0 on
success.  It also does not distinguish physically absent and offline
CPUs, and does not set errno.

cpufreq-set has already been fixed (commit c25badc9ceb6).

In cpufreq-bench, which prints an error message for offline CPUs,
properly distinguish and report the zero and negative cases.

Reported-by: Jose <jjorge@free.fr>
Reported-by: Julien RIVAUD <frnchfrgg@free.fr>
Cc: stable <stable@vger.kernel.org> # 4.7+
Fixes: ac5a181d065d ("cpupower: Add cpuidle parts into library")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name cpupower-fix-checks-for-cpu-existence.patch
tools/power/cpupower/bench/system.c